local jueshi = fk.CreateSkill{
  name = "hanqing__jueshi",
  tags = { Skill.Lord },
}

Fk:loadTranslationTable{
  ["hanqing__jueshi"] = "决势",
  [":hanqing__jueshi"] = "主公技，你的回合外，当一名角色使用【杀】时，你可以弃置所有手牌并选择一项：1.此【杀】不能被响应；2.此【杀】伤害+1。"..
  "背水：该角色为秦势力角色。",

  ["#hanqing__jueshi-invoke"] = "决势：是否弃置所有手牌，令 %dest 使用的%arg附加效果？",
  ["hanqing__jueshi1"] = "不能被响应",
  ["hanqing__jueshi2"] = "伤害+1",
  ["hanqing__jueshi3"] = "对于秦势力角色可以背水",
}

jueshi:addEffect(fk.CardUsing, {
  anim_type = "offensive",
  can_trigger = function(self, event, target, player, data)
    return player:hasSkill(jueshi.name) and
      player.room.current ~= player and data.card.trueName == "slash" and not player:isKongcheng()
  end,
  on_cost = function (self, event, target, player, data)
    local room = player.room
    local choices = {"Cancel"}
    if table.find(player:getCardIds("h"), function (id)
      return not player:prohibitDiscard(id)
    end) then
      table.insert(choices, "hanqing__jueshi1")
      table.insert(choices, "hanqing__jueshi2")
      if target.kingdom == "qin" then
        table.insert(choices, "hanqing__jueshi3")
      end
    end
    local choice = room:askToChoice(player, {
      choices = choices,
      skill_name = jueshi.name,
      prompt = "#hanqing__jueshi-invoke::"..target.id..":"..data.card:toLogString(),
      all_choices = { "hanqing__jueshi1", "hanqing__jueshi2", "hanqing__jueshi3", "Cancel" },
    })
    if choice ~= "Cancel" then
      event:setCostData(self, {choice = choice})
      return true
    end
  end,
  on_use = function(self, event, target, player, data)
    local choice = event:getCostData(self).choice
    player:throwAllCards("h", jueshi.name)
    if choice[16] ~= "2" then
      data.disresponsiveList = table.simpleClone(player.room.players)
    end
    if choice[16] ~= "1" then
      data.additionalDamage = (data.additionalDamage or 0) + 1
    end
  end,
})

return jueshi
